/**
 * Copyright (c) 2017 hadlinks, All Rights Reserved.
 */
package com.bugull.farm.core.frame.exception;

import com.bugull.farm.core.enums.ErrorCodeEnum;

/**
 * Project Name: sanquan-farm 
 * Package Name: com.bugull.farm.core.Exception 
 * ClassName: BuguAbstractException 
 * Function: TODO ADD FUNCTION.  
 * date: 2017/9/11 10:29
 * @author songwei (songw@hadlinks.com)
 * @since JDK 1.8 
 */
public abstract class BuguAbstractException extends RuntimeException{

    private static final long serialVersionUID = 1398510558582059367L;

    protected String errorMessage; //异常的具体信息

    protected ErrorCodeEnum errorCode = ErrorCodeEnum.SERVICE_INTERNAL_ERROR; //异常的错误码，默认为服务器内部错误

    public BuguAbstractException(String errorMessage) {
        super(errorMessage);
        this.errorMessage = errorMessage;
    }

    public BuguAbstractException(ErrorCodeEnum errorCode) {
        super();
        this.errorCode = errorCode;
    }

    public BuguAbstractException(String errorMessage, ErrorCodeEnum errorCode) {
        super(errorMessage);
        this.errorCode = errorCode;
    }

    public BuguAbstractException(String errorMessage, Throwable cause) {
        super(errorMessage, cause);
        this.errorMessage = errorMessage;
    }

    public BuguAbstractException(String errorMessage, ErrorCodeEnum errorCode, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public BuguAbstractException(Throwable cause) {
        super(cause);
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public ErrorCodeEnum getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(ErrorCodeEnum errorCode) {
        this.errorCode = errorCode;
    }
}
